package cn.iocoder.yudao.module.bpm.dal.mysql.tohandle;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.bpm.controller.admin.tohandle.task.vo.BpmHandleTaskExportReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.tohandle.task.vo.BpmHandleTaskPageReqVO;
import cn.iocoder.yudao.module.bpm.dal.dataobject.tohandle.BpmHandleTaskDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 审批流待办中心——任务 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BpmHandleTaskMapper extends BaseMapperX<BpmHandleTaskDO> {

    default PageResult<BpmHandleTaskDO> selectPage(BpmHandleTaskPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BpmHandleTaskDO>()
                .eqIfPresent(BpmHandleTaskDO::getBpmHandleFlowId, reqVO.getBpmHandleFlowId())
                .eqIfPresent(BpmHandleTaskDO::getExtTaskId, reqVO.getExtTaskId())
                .eqIfPresent(BpmHandleTaskDO::getTaskType, reqVO.getTaskType())
                .likeIfPresent(BpmHandleTaskDO::getHandleUsername, reqVO.getHandleUsername())
                .likeIfPresent(BpmHandleTaskDO::getHandleName, reqVO.getHandleName())
                .eqIfPresent(BpmHandleTaskDO::getSourceSystemId, reqVO.getSourceSystemId())
                .likeIfPresent(BpmHandleTaskDO::getSourceUrl, reqVO.getSourceUrl())
                .eqIfPresent(BpmHandleTaskDO::getTaskStatus, reqVO.getTaskStatus())
                .betweenIfPresent(BpmHandleTaskDO::getHandleTime, reqVO.getHandleTime())
                .likeIfPresent(BpmHandleTaskDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(BpmHandleTaskDO::getCreateTime, reqVO.getCreateTime())
                .betweenIfPresent(BpmHandleTaskDO::getUpdateTime, reqVO.getUpdateTime())
                .likeIfPresent(BpmHandleTaskDO::getCreator, reqVO.getCreator())
                .likeIfPresent(BpmHandleTaskDO::getUpdater, reqVO.getUpdater())
                .eqIfPresent(BpmHandleTaskDO::getDeleted, reqVO.getDeleted())
                .orderByDesc(BpmHandleTaskDO::getId));
    }

    default List<BpmHandleTaskDO> selectList(BpmHandleTaskExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BpmHandleTaskDO>()
                .eqIfPresent(BpmHandleTaskDO::getBpmHandleFlowId, reqVO.getBpmHandleFlowId())
                .eqIfPresent(BpmHandleTaskDO::getExtTaskId, reqVO.getExtTaskId())
                .eqIfPresent(BpmHandleTaskDO::getTaskType, reqVO.getTaskType())
                .likeIfPresent(BpmHandleTaskDO::getHandleUsername, reqVO.getHandleUsername())
                .likeIfPresent(BpmHandleTaskDO::getHandleName, reqVO.getHandleName())
                .eqIfPresent(BpmHandleTaskDO::getSourceSystemId, reqVO.getSourceSystemId())
                .likeIfPresent(BpmHandleTaskDO::getSourceUrl, reqVO.getSourceUrl())
                .eqIfPresent(BpmHandleTaskDO::getTaskStatus, reqVO.getTaskStatus())
                .betweenIfPresent(BpmHandleTaskDO::getHandleTime, reqVO.getHandleTime())
                .likeIfPresent(BpmHandleTaskDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(BpmHandleTaskDO::getCreateTime, reqVO.getCreateTime())
                .betweenIfPresent(BpmHandleTaskDO::getUpdateTime, reqVO.getUpdateTime())
                .likeIfPresent(BpmHandleTaskDO::getCreator, reqVO.getCreator())
                .likeIfPresent(BpmHandleTaskDO::getUpdater, reqVO.getUpdater())
                .eqIfPresent(BpmHandleTaskDO::getDeleted, reqVO.getDeleted())
                .orderByDesc(BpmHandleTaskDO::getId));
    }

}
